package pteam;


import java.util.*;

import simulator.Actor;
import simulator.Robot;
import simulator.Sensor;
import simulator.Simulator;
public class PlanDActor  implements Actor {
  public final int TOLERANCE = 5;
  public final int TOOCLOSE = 15;
  public final int FARDIST = 2;
  public final int FARANGLE = 1;
  public final int NOTFARDIST = 5;
  public final int NOTFARANGLE = 1;
  public final int BACKDIST = 15;
  public final int NINETY = 90;
  public boolean tooClose ;
  public String getMaze() {
    return "Super";
  }

  public void act(Robot r) {
    if (tooClose) {
      r.turnRight();
      r.waitAngle(20);
      Simulator.out.println("here i'm circling");
    } else {
      r.goForward();
      r.waitDistance(2);
      Simulator.out.println("did i go forward again?");
      r.turnLeft();
      r.waitAngle(10);
//      try { Thread.sleep(100); } catch(Exception e) {}
      
    }
  }
    
  public void updateSensors(Sensor[] s) {
    if (s[4].getState()[0] < TOOCLOSE) {  //
      tooClose = true;
    } else { tooClose = false;}
  }
}